#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef long double ld;
const int NN=5e5+4;
struct segment_tree
{
    int l,r;
    ll cnt;
    ld val;
}tr[NN<<2];
vector<ld>nums;
void build(int u,int l,int r)
{
    tr[u]={l,r,0,0};
    if(l==r)
        return;
    int mid=l+(r-l)/2;
    build(u<<1,l,mid);
    build(u<<1|1,mid+1,r);
}
void pushup(int u)
{
    tr[u].cnt=tr[u<<1].cnt+tr[u<<1|1].cnt;
    tr[u].val=tr[u<<1].val+tr[u<<1|1].val;
}
void modify(int u,int p,int w)
{
    if(tr[u].l==tr[u].r)
    {
        tr[u].cnt+=w;
        tr[u].val+=w*nums[p];
        return;
    }
    int mid=tr[u].l+(tr[u].r-tr[u].l)/2;
    if(p<=mid)
        modify(u<<1,p,w);
    else
        modify(u<<1|1,p,w);
    pushup(u);
}
pair<int,ld>query(int u,ll k)
{
    if(tr[u].l==tr[u].r)
        return {tr[u].l,k*nums[tr[u].l]};
    if(tr[u<<1].cnt>=k)
        return query(u<<1,k);
    pair<int,ld>w=query(u<<1|1,k-tr[u<<1].cnt);
    return {w.first,w.second+tr[u<<1].val};
}
ld p[NN];
int del[NN],t[NN],a[NN];
int main()
{
    freopen("love.in","r",stdin);
    freopen("love.out","w",stdout);
    int n,m=0;
    scanf("%d",&n);
    nums.push_back(0);
    for(int i=1;i<=n;i++)
    {
        int op;
        scanf("%d",&op);
        if(op==1)
        {
            int f,b;
            scanf("%d%d%d",&f,&t[++m],&b);
            if(!t[m])
            {
                a[m]=b;
                del[i]=-m;
                continue;
            }
            if(t[m]<0)
                t[m]=-t[m],b=-b;
            p[m]=f+1.0*b/t[m];
            nums.push_back(p[m]);
            del[i]=-m;
        }
        else
            scanf("%d",&del[i]);
    }
    sort(nums.begin(),nums.end());
    nums.erase(unique(nums.begin(),nums.end()),nums.end());
    build(1,0,nums.size()-1);
    ll res=0;
    for(int i=1;i<=n;i++)
    {
        if(!t[abs(del[i])])
        {
            if(del[i]<0)
                res+=a[-del[i]];
            else
                res-=a[del[i]];
        }
        else
        {
            int x=lower_bound(nums.begin(),nums.end(),p[abs(del[i])])-nums.begin();
            if(del[i]<0)
                modify(1,x,t[-del[i]]);
            else
                modify(1,x,-t[del[i]]);
        }
        pair<int,ld>w=query(1,(tr[1].cnt+1)/2);
        printf("%.10Lf\n",nums[w.first]*((tr[1].cnt+1)/2)-w.second+tr[1].val-w.second-nums[w.first]*(tr[1].cnt-(tr[1].cnt+1)/2)+res);
    }
    return 0;
}